import { lazy } from "react";

const NotFound = lazy(() => import('../page/_404')),
    Index = lazy(() => import('../page/user/index')),
    School = lazy(() => import('../page/user/userManagement/School')),
    SchoolDetail = lazy(() => import('../page/user/userManagement/School/Detail')),
    Class = lazy(() => import('../page/user/userManagement/Class')),
    ClassDetail = lazy(() => import('../page/user/userManagement/Class/Detail')),
    Lesson = lazy(() => import('../page/user/courseManagement/Lesson')),
    LessonDetail = lazy(() => import('../page/user/courseManagement/Lesson/Detail')),
    Homework = lazy(() => import('../page/user/courseManagement/Homework')),
    HomeworkDetail = lazy(() => import('../page/user/courseManagement/Homework/Detail')),
    Message = lazy(() => import('../page/user/messageManagement/Message')),
    Notice = lazy(() => import('../page/user/messageManagement/Notice'));
/*
* 也可用自动化工程方法 require.context获取组件
* 此方法略复杂
* */
const routes = [
    {
        path: '/user',
        component: Index,
        meta: {
            title: '欢迎使用'
        }
    },
    {
        name: "用户管理",
        path: "/user/user_mg",
        routes: [
            {
                path: '/user/user_mg/school',
                component: School,
                meta: {
                    title: '学校列表'
                },
                routes:[
                    {
                        path: '/user/user_mg/school/:id',
                        component: SchoolDetail,
                        meta: {
                            title: '学校详情'
                        }
                    }
                ]
            },
            {
                path: '/user/user_mg/class',
                component: Class,
                meta: {
                    title: '班级列表'
                },
                routes:[
                    {
                        path: '/user/user_mg/class/:id/:cd',
                        component: ClassDetail,
                        meta: {
                            title: '班级详情'
                        }
                    }
                ]
            }
        ]
    },
    {
        name: "课题管理",
        path: "/user/course_mg",
        routes: [
            {
                path: '/user/course_mg/lesson',
                component: Lesson,
                meta: {
                    title: '实训课题'
                },
                routes: [
                    {
                        path: '/user/course_mg/lesson/:id',
                        component: LessonDetail,
                        meta: {
                            title: '课程详情'
                        }
                    }
                ]
            },
            {
                path: '/user/course_mg/homework',
                component: Homework,
                meta: {
                    title: '课题练习'
                },
                routes: [
                    {
                        path: '/user/course_mg/homework/:id',
                        component: HomeworkDetail,
                        meta: {
                            title: '练习详情'
                        }
                    }
                ]
            }
        ]
    },
    {
        name: "公告管理",
        path: "/user/message_mg",
        routes: [
            {
                path: '/user/message_mg/notice',
                component: Notice,
                meta: {
                    title: '公告列表'
                },
                routes: [

                ]
            },
            {
                path: '/user/message_mg/message',
                component: Message,
                meta: {
                    title: '消息通知'
                },
                routes: [

                ]
            }
        ]
    },
    {
        path: '*',
        component: NotFound,
        meta: {
            title: '404'
        }
    }
];

export default routes